package com.foreknow.elmboot.controller;

import com.foreknow.elmboot.po.DeliveryAddress;
import com.foreknow.elmboot.service.DeliveryAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/DeliveryAddressController")
public class DeliveryAddressController {

    @Autowired
    private DeliveryAddressService deliveryAddressService;

    @RequestMapping("/queryAddressByDaId")
    public DeliveryAddress queryAddressByDaId(Integer daId){
        return deliveryAddressService.queryAddressByDaId(daId);
    }


    @RequestMapping("/queryAddressByUserId")
    public List<DeliveryAddress> queryAddressByUserId(String userId){
        return deliveryAddressService.queryAddressByUserId(userId);
    }


    @RequestMapping("/addAddress")
    public int addAddress(DeliveryAddress deliveryAddress){
        return deliveryAddressService.addAddress(deliveryAddress);
    }


    @RequestMapping("/deleteAddress")
    public int deleteAddress(Integer daId){
        return deliveryAddressService.deleteAddress(daId);
    }


    @RequestMapping("/updateAddress")
    public Object updateAddress(DeliveryAddress deliveryAddress){
        return deliveryAddressService.updateAddress(deliveryAddress);
    }
}
